﻿<div class="game-main" style="/*width:760px;*/margin-top:-5px;/*margin-right: 10px;*/">
  <div id="bet-game">
    <div class="game-btn">
      <?php
		if($_COOKIE['mode']){
			$mode=$_COOKIE['mode'];
		}else{
			$mode=2.00;
		}
		$this->getSystemSettings();
		$this->getTypes();
		$sql="select id, groupName, enable from {$this->prename}played_group where enable=1 and type=? order by sort";
		$groups=$this->getObject($sql, 'id', $this->types[$this->type]['type']);
		if($this->groupId && !$groups[$this->groupId]) unset($this->groupId);
		if($groups) foreach($groups as $key=>$group){
			if(!$this->groupId) $this->groupId=$group['id'];
	?>
      <div class="ul-li<?=($this->groupId==$group['id'])?' current':''?>"> <a class="cai" href="/index.php/index/group/<?=$this->type .'/'.$group['id']?>"><span class="content">
        <?=$group['groupName']?>
        </span></a> </div>
      <?php } ?>
      <div class="clear"></div>
    </div>
    <div class="game-cont" style="width:760px; float:left;">
      <?php $this->display('index/inc_game_played.php'); ?>
      <div class="num-table" style="height:auto;" id="game-dom">
        <div class="fandian">
          <div class="fandian-k" style="display:none"> <span class="spn8">奖金：</span> <span id="fandian-value" class="fdmoney" ><?=$maxPl?></span>
            <div class="fandian-box">
              <div id='basic_slider'  value="<?=$this->ifs($_COOKIE['fanDian'], 0)?>" data-bet-count="<?=$this->settings['betMaxCount']?>" data-bet-zj-amount="<?=$this->settings['betMaxZjAmount']?>" max="<?=$this->user['fanDian']?>" game-fan-dian="<?=$this->settings['fanDianMax']?>" fan-dian="<?=$this->user['fanDian']?>" game-fan-dian-bdw="<?=$this->settings['fanDianBdwMax']?>" fan-dian-bdw="<?=$this->user['fanDianBdw']?>" min="0" step="0.1"></div>
            </div>
            <span id="fandian-value2" class="fdmoney2">/0%</span> </div>
          <script>
		 var flag=false;
			slider=noUiSlider.create($("#basic_slider")[0], {
				start: 0,
				animate: true,
				range: {
					min: 0,
					max: <?= ((int) $this->user['fanDian']) > 0 ? (int) $this->user['fanDian'] : 1?>
				},
			});
			slider.on('update',function(value){
				flag&&gameSetFanDian(parseFloat(value[0]));
				flag=true
			});
		 </script> 
          
          <!--div class="danwei">
					<span class="spn8">模式：</span>
					<?php if($this->settings['yuanmosi']==1){?>
					<label>元<input type="radio" value="2.000" data-max-fan-dian="<?=$this->settings['betModeMaxFanDian0']?>" name="danwei" <?=$this->iff($mode=='2.000','checked')?> /></label><?php } ?>
					<?php if($this->settings['jiaomosi']==1){?>
					<label>角<input type="radio" value="0.200" data-max-fan-dian="<?=$this->settings['betModeMaxFanDian1']?>" name="danwei" <?=$this->iff($mode=='0.200','checked')?> /></label><?php } ?>
					<?php if($this->settings['fenmosi']==1){?>
					<label>分<input type="radio" value="0.020" data-max-fan-dian="<?=$this->settings['betModeMaxFanDian2']?>" name="danwei" <?=$this->iff($mode=='0.020','checked')?> /></label><?php } ?>
					<?php if($this->settings['limosi']==1){?>
					<label>厘<input type="radio" value="0.002" data-max-fan-dian="<?=$this->settings['betModeMaxFanDian3']?>" name="danwei" <?=$this->iff($mode=='0.002','checked')?> /></label><?php } ?>
				</div-->
          
          <div class="fl" style="display:none">
            <?php if($this->settings['yuanmosi']==1){?>
            <b value="2.000" data-max-fan-dian="<?=$this->settings['betModeMaxFanDian0']?>" class="danwei dwon">元</b>
            <?php } ?>
            <?php if($this->settings['jiaomosi']==1){?>
            <b value="0.200" data-max-fan-dian="<?=$this->settings['betModeMaxFanDian1']?>" class="danwei">角</b>
            <?php } ?>
            <?php if($this->settings['fenmosi']==1){?>
            <b value="0.020" data-max-fan-dian="<?=$this->settings['betModeMaxFanDian2']?>" class="danwei">分</b>
            <?php } ?>
            <?php if($this->settings['limosi']==1){?>
            <b value="0.002" data-max-fan-dian="<?=$this->settings['betModeMaxFanDian2']?>" class="danwei">厘</b>
            <?php } ?>
          </div>
          <div class="beishu"> <span class="spn8">倍数：</span>
            <input type="button" class="surbeishu" value="-"/>
            <input id="beishu" value="<?=$this->ifs($_COOKIE['beishu'],1)?>" class="txt"/>
            <input type="button" class="addbeishu" value="+"/>
          </div>
          <div class="addOrderBox">
            <div class="prompt" id="game-tip-dom">请选择号码</div>
            <input type="button" class="addBtn" onclick="gameActionAddCode()" value="添加投注">
          </div>
        </div>
      </div>
    </div>
    <div style="width:200px;float:left;">
    <style>
	.log{ width:200px; border:1px solid #ddd; margin-bottom:10px;}
	.log th , .log td{ padding:2px 5px;    height: 24px; text-align:center;}
	.log thead th{     background: #ddd;}
	.log tbody tr{ border-bottom:1px dotted #ddd;}
	</style>
    <h3 style="font-size: 18px; background: #b62236 ; padding: 10px; color: #fff;">开奖记录</h3>
    <table id="detailKjHistory" class="log">
    <thead>
    <tr>
    <th>期数</th>
    <th>中奖号码</th>
   </tr>
    </thead>
    <tbody>
    </tbody>
    </table>
    <script type="text/javascript">
      function getHistory(){
        $.ajax({
          url: "/index.php/game/kjRecord/<?=$this->type ?>/10",
          async:true,
          type:'get',
          dataType:'json',
          error:function(xhr, textStatus, errThrow){
            call.call(self, errThrow||textStatus);
          },
          success:function(data, textStatus, xhr, headers){
            if(data){
              var html = "";

              for (var i = 0; i < data.length; i++) {
                html += '<tr><td>' + data[i].number + '</td><td>' + data[i].data + '</td></tr>';
              }
              $("#detailKjHistory tbody").html(html);
            }
          }
        });
      }
      $(document).ready(function(){
        getHistory();
        setInterval(function(){
          getHistory();
        }, 1000 * 60);
      });
    </script>
    </div>
      <div class="clear"></div>
  </div>
</div>
<div class="touzhu">
  <div class="lotteryBottom">
    <div class="addList">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tbody>
          <tr>
            <td width="100%"><div class="lotteryList">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" id="lt_cf_content">
                  <tbody>
                    <tr class="cleanall">
                      <th>玩法与投注号码</th>
                      <th>注数</th>
                      <th>倍投</th>
                      <th>金额</th>
                      <th><a href="javascript:;" onclick="gameActionRemoveCode()" class="deleteAll cleanall">全删</a></th>
                    </tr>
                  </tbody>
                </table>
              </div></td>
            <td><div class="jixuan" id="lt_random_area"></div></td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="touzhu-bottom">
      <div class="tz-tongji">
        <p>已选 <span id="lt_cf_count" class="num">0</span> 单，</p>
        <p>共计 <span id="lt_cf_nums" class="num">0</span> 注</p>
        <p>总金额 <span id="lt_cf_money" class="num orange">0</span> 元</p>
        <div class="tz-buytype"></div>
      </div>
      <label class="zh_title tz-buytype fqzhBox" name="lt_trace_if" style="padding: 3px 14px 3px 14px;line-height: 42px; /* height: 42px; */width: 132px;text-align: center;background: url(/images/nsc/lottery/tz.png) no-repeat;/* margin-left: -13px; */font-size: 20px; display: inline-block;
				color: #FFF; cursor: pointer;/* margin-top: -53px;*//*  margin-left: 230px;*/border-radius: 4px;float: right;">
        <input name="zhuiHao" id="lt_trace_if" style="display:none" value="yes" type="checkbox">
        追号</span> </label>
      <div class="sendChoose"><a href="javascript:;" class="sendBtn" id="btnPostBet">立即投注</a></div>
      <div class="hemai" style="margin: 17px 15px 0 0;float: right;display: inline;">
        <input type="checkbox" class="is_combine" id="cannel_chckbox" style="display: inline;margin-top: 3px;width: 18px;height: 17px;float: left;margin-right: 2px;cursor: pointer;"/>
        <b class="fq" style="height: 22px;color: #ff632c;font-size: 13px;">发起合买</b> </div>
      <div  class="hemaiBox">
        <p>我要分为：
          <input type="text" name="combine_copies" value="1" class="amount" id="fenshu" />
          份，每份<span id="meifen">￥0.00</span>元 每份至少￥1.00元</p>
        <p>我要认购：
          <input type="text" name="amount" value="1" class="amount" id="rengou" />
          份，（<span id="rengou100">100%</span>），</p>
        <p>
          <input name="combine_is_guarantee" id="combine_is_guarantee" type="checkbox" value="1" class="mul " style="width:18px; margin-right:0; display:inline-block;" />
          我要保底：
          <input type="text" name="combine_min_guarantee_copies" id="combine_min_guarantee_copies" value="1" disabled value="" class="amount" />
          份，<span id="baodi">￥0.00</span>元，（<span id="baodi100">100%</span>）</p>
      </div>
    </div>

    <?php if($this->settings['tzjl']==1){?>
  </div>
  <div id="znz-game" style="display:none;"></div>
</div>
<div class="warp lotteryHistory">
<div class="lotteryHistoryBody"> </div>
<div class="line">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
        <th>单号</th>
        <th>投注时间</th>
        <th>彩种</th>
        <th>玩法</th>
        <th>期号</th>
        <th>投注号码(点击查看)</th>
        <th>倍数</th> 
        <th>金额(元)</th>
        <th>奖金(元)</th>
        <!--th>操作</th-->
      </tr>
    </thead>
    <tbody id="order-history">
      <?php $this->display('index/inc_game_order_history.php'); ?>
    </tbody>
  </table>
  <div class="getMore"><a class="sqlist" href="/index.php/record/search" title="查看更多投注记录" target="_blank">查看更多</a></div>
</div>
<?php } ?>
<div class="clear"></div>
<script>
function meifen() {
	$('#meifen').html('￥' + Number($('#lt_cf_money').html() / $('#fenshu').val()).toFixed(2));
}

function rengou() {
	$('#rengou100').html((Number($('#rengou').val() / $('#fenshu').val()) * 100).toFixed(2) + '%');
}

function baodi() {
	$('#baodi').html('￥' +(Number($('#lt_cf_money').html() / $('#fenshu').val())*Number($('#combine_min_guarantee_copies').val())).toFixed(2));
}

function baodi100() {
	$('#baodi100').html((Number($('#combine_min_guarantee_copies').val() / $('#fenshu').val()) * 100).toFixed(2) + '%');
}
$('#cannel_chckbox').click(function() {
	if ($(this)[0].checked) {
		$('.hemaiBox').show();
		meifen();
		baodi();
	} else {
		$('.hemaiBox').hide();
	}

});
$('#fenshu').keyup(function() {
	meifen();
	rengou();
	baodi();
	baodi100();
});
$('#rengou').keyup(function() {
	if (Number($(this).val()) > Number($('#fenshu').val())) {
		alert('认购份数不能超过总份数！');
	}
	rengou();
});
$('#combine_is_guarantee').click(function() {
	if ($(this)[0].checked) {
		$('#combine_min_guarantee_copies').attr('disabled', false);
	} else {
		$('#combine_min_guarantee_copies').attr('disabled', true);
	}

});

$('#combine_min_guarantee_copies').keyup(function() {
	if (Number($(this).val()) > Number($('#fenshu').val())) {
		alert('保底份数不能超过总份数！');
	}
	baodi();
	baodi100();
});
</script>
<div class="clear"></div>